﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>MERCHANT CENTER</title>
		<%@ include file="/share/include.jsp" %>
   		 <meta name="viewport" content="width=device-width, initial-scale=1">
		 <script type="application/x-javascript"> 
			addEventListener("load", function() { 
				setTimeout(hideURLbar, 0); 
			}, false); 
			function hideURLbar(){ 
				window.scrollTo(0,1); 
			} 
		</script>
		<script type="text/javascript">
			function editStatus(value,title,id,name){
		      	art.dialog({
					width: 250,
					height: 100,
					fixed: true,
				    padding: 0,
				    title: title+"提示",
				    content: "是否确认<font style='color:red'>"+title+"</font>案例 "+name+" ？",
				    lock: true,
				    button: [{
					    name: "确定",
					    callback: function () {
					    	$.ajax({
								 url: "${root}/control/shop/casesController/editStatus.do?caseId="+id,
								 data: {
								 	"casesStatus":value
								 },
								 type: "post",
								 success: function(data){
						        	if(data=="true"){
						        		var url = '${root }/control/shop/casesController/list.do?caseShopId=${form.caseShopId}&page=${pageView.currentpage}&';
										/* var param = $('#searchForm').serialize();
										url = url+param; */
						        		artDalog(title+"提示","案例 "+name+" "+title+"成功",url);
						        		//search("searchForm");
						        	}else{
						        		artDalog("错误信息","案例 "+name+" 不存在，无法"+title+"！",null);
						        	}
						      	}
						   	});
					    },
				        focus: true
				     },
				     {
				        name: "取消"
				     }]
				});
		      }
		</script>
	</head>
	<body>
		<!-- container -->
		<!-- header -->
		<div class="header">
			<%@ include file="/control/jsp/layout/header.jsp" %>
			<!-- /bottom-header -->
		</div>
		<!-- header -->
		<!--- top-nav -->
			<%@ include file="/control/jsp/layout/sellerMenu.jsp" %>
		<!--- top-nav -->
		<!-- /script-for-nav -->
		<!-- Product-Details-page -->
		<div class="details-page">
			<div class="content details-page">
				<div class="product-details">
					<div class="container">
						<div class="details-left" style="width: 100%;">
						    <h4 style="color:red;"><img style="padding: 10px;" src="${root}/images/bx.gif" />案例一览</h4>
							<table style="margin: 20px;width: 100%;">
								<tbody><tr>
									<td align="right"> 
										<input type="submit" name="BtnSubmit" onclick="location.href='${root }/control/shop/casesController/displayAdd.do?caseShopId=${suSession.shopId}'" value="添加案例" id="BtnSubmit" class="p-btn"> &nbsp;&nbsp;
									</td>
								</tr>
							</tbody></table>
							<table class="list_order" border="0" align="center" cellpadding="0" cellspacing="2">
							  <thead>
								<tr style="height:40px;">
								  <th>案例图片</th>
								  <th>案例名称</th>
								  <th>户型</th>
								  <th>面积</th>
								  <th>造价</th>
								  <th>状态</th>
								  <th>上下架</th>
								  <th>操作</th>
								</tr>
							  </thead>
							  <tbody style="text-align: center;">
								<c:if test="${not empty pageView.records }">
									<c:forEach items="${pageView.records }" var='cases'>
							  	        <tr style="height: 20px;"></tr>
										<tr style="height: 80px;">
										  <td>
										  	<c:if test="${not empty cases and not empty cases.picList }">
						  						<c:forEach items="${cases.picList }" var="pic" begin="0" end="0">
						  							<img src="${imageService }${pic.picPath}" title="${cases.caseTitle }" alt="${cases.caseTitle }"  style="height: 100px;width: 100px;"  />
						  						</c:forEach>
						  					</c:if>
										  </td>
										  <td>${fn:escapeXml(cases.caseTitle)}</td>
										  <td>${fn:escapeXml(cases.caseHouseType)}</td>
										  <td>${cases.caseArea}㎡</td>
										  <td>$ ${cases.casePrice}</td>
										  <td>
										  	<c:if test="${cases.casesStatus == 1}">展示中</c:if>
					                   		<c:if test="${cases.casesStatus == 2}">已下架</c:if>
					                   		<c:if test="${cases.casesStatus == 0}">待上架</c:if>
										  </td>
										  <td>
										  	<c:if test="${cases.casesStatus == 1}"><a href="javascript:editStatus('2','下架','${fn:escapeXml(cases.caseId)}','${fn:escapeXml(cases.caseTitle)}');">下架</a></c:if>
					                   		<c:if test="${cases.casesStatus == 2}"><a href="javascript:editStatus('1','重新上架','${fn:escapeXml(cases.caseId)}','${fn:escapeXml(cases.caseTitle)}');">重新上架</a></c:if>
					                   		<c:if test="${cases.casesStatus == 0}"><a href="javascript:editStatus('1','上架','${fn:escapeXml(cases.caseId)}','${fn:escapeXml(cases.caseTitle)}');">上架</a></c:if>
										  </td>
										  <td>
										  	<a href="${root }/control/shop/casesController/displayEdit.do?caseId=${cases.caseId}">编辑</a>
										  	<a href="${root }/control/layoutController/displayCaseDetail.do?caseId=${cases.caseId}">预览</a>
										  </td>
										</tr>
									</c:forEach>
								</c:if>
							 </tbody>
							 </table>
						</div>
						<div class="clearfix"> </div>
					</div>
					<br>
					<c:if test="${not empty pageView.records }">
					<!--page-->
					 <%@ include file="/share/pageTwo.jsp" %>
					<!--end page-->
					</c:if>
			    </div>
		    </div>
		</div>
		<!-- /Product-Details-page -->
		<!-- footer -->
		<%@ include file="/control/jsp/layout/footer.jsp" %>
</body>
</html>

